<template>
	<view>
		<view class="w100 flex-center ">
			<image style="width: 400rpx;height: 400rpx;margin-top: 100rpx;" src="../../static/logo.png" mode=""></image>
		</view>
		<view class="body w100">
			<view class="s1 w100 flex-center ">
				登陆账号
			</view>
			<view class=" w100 flex-center mt-60">
				<view class="body2">
					<view style="display: flex;align-items: center;">
						<image class="mr-20" style="width: 64rpx;height: 64rpx;" src="../../static/images/home/log1.png"
							mode=""></image>
						<u--input color='#fff' placeholder="登陆账号/手机号" border="none" v-model="username"></u--input>
					</view>
					<view class="mt-30 mb-30" style="border: 1rpx solid rgba(83, 87, 112, 1);height: 1rpx;width: 100%;">
					</view>
					<view style="display: flex;align-items: center;">
						<image class="mr-20" style="width: 64rpx;height: 64rpx;" src="../../static/images/home/log2.png"
							mode=""></image>
						<u--input color='#fff' type='password' placeholder="密码" border="none"
							v-model="password"></u--input>
					</view>
				</view>
			</view>
			<view class="flex-b w100 mt-100" style="	padding: 30rpx 40rpx;">
				<view class="s2" @click="zhu">
					注册
				</view>

				<view class="s3 flex-center" @click="login">
					立即登录
				</view>
			</view>
		</view>

	</view>
</template>
<script>
	export default {
		data() {
			return {
				username: '',
				password: ''
			}
		},
		onLoad() {

		},

		methods: {
			async login() {

				let param = {
					username: this.username,
					password: this.password
				}
				let sharecode = uni.getStorageSync('sharecode')
				if (sharecode) {
					param.sharecode = sharecode
				}
				let res = await this.$http.post('user/login', param)
				// return
				console.log('res: ', res);
				if (res.code == 200) {
					uni.removeStorageSync('sharecode')
					uni.setStorageSync('token', res.data.user_id)
					this.getUserInfo()
					uni.switchTab({
						url: '/pages/index/index'
					})
				} else {
					uni.$u.toast('账号或密码错误')
				}

			},

			zhu() {
				uni.navigateTo({
					url: '/pages/login/login_old'
				})
			}
		}
	}
</script>
<style lang="less" scoped>
	page {
		background-color: #1E2240;
	}

	.body {
		margin-top: 89rpx;
		padding: 100rpx 50rpx;
		border-radius: 64rpx 64rpx 0rpx 0rpx;
		background: #24294D;
	}

	.s1 {
		font-size: 64rpx;
		font-weight: 600;
		color: #fff;
	}

	.s2 {
		font-size: 28rpx;
		font-weight: 500;
		letter-spacing: 0rpx;
		line-height: 39.2rpx;
		color: rgba(118, 125, 255, 1);
	}

	.s3 {
		width: 328rpx;
		height: 106rpx;
		opacity: 1;
		border-radius: 80rpx;
		background: rgba(108, 106, 235, 1);
		box-shadow: 0rpx 40rpx 60rpx rgba(25, 28, 50, 0.1);
		font-size: 30rpx;
		font-weight: 600;
		color: #fff;
	}

	.body2 {
		width: 650rpx;
		height: 260rpx;
		opacity: 1;
		border-radius: 30rpx;
		background: #434769;
		padding: 30rpx 40rpx;
	}
</style>